﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
public partial class adminstrator_findTSJY : System.Web.UI.Page
{
    public OleDbConnection myconnection;
    public static readonly string sconnectionstring = System.Configuration.ConfigurationManager.AppSettings["SQLConnString"].ToString();

    protected void Page_Load(object sender, EventArgs e)
    {
        myconnection = new OleDbConnection(sconnectionstring);
        myconnection.Open();
        if (Session["UserName"] == null && Session["UserNo"] == null)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>" +
                "alert('登陆超时(或未登录),请您重新登陆！'),parent.location.href='..index.aspx/'</script>", false);
        }
        if (!IsPostBack)
        {
            bind1();
        }
    }
    public void bind1()
    {
        string mysql = "select * from StuTJ ";//in(select sno from UsqbTb where sno   where Stutj  ='" + Session["UserNo"].ToString() + "'
        OleDbCommand mycmd = new OleDbCommand(mysql, myconnection);
        OleDbDataAdapter Adapter = new OleDbDataAdapter();
        Adapter.SelectCommand = mycmd;
        DataSet myDS = new DataSet();
        Adapter.Fill(myDS);
        if (myDS.Tables.Count > 0 && myDS.Tables[0].Rows.Count > 0)
        {
            GridView1.DataSource = myDS;
            GridView1.DataKeyNames = new string[] {"TJ","Stutj"};
            GridView1.DataBind();
            label1.Text = "";
        }
    }
}